<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>



<link href="<c:url value="/resources/css/style5.css" />" rel="stylesheet">

<script type="text/javascript"
	src="<c:url value="/resources/jquery-2.1.1.js" />"> </script>
<script type="text/javascript"
	src="<c:url value="/resources/jquery.displaytag-ajax-1.2.js" />"> </script>
<script type="text/javascript">

	$(document).ready(function() {
alert("3");
/*		$('#sampleForm').submit(
				function(event) {
					var firstname = $('#firstname').val();
					var lastname = $('#lastname').val();				
					var data = 'logout='
							+ encodeURIComponent(firstname)
							+ '&amp;error='
							+ encodeURIComponent(lastname);
					$.ajax({
						url : $("#sampleForm").attr("action"),
						data : data,
						type : "GET",
		 
						success : function(response) {
							alert( "listo" );
							alert( response );
						},
						error : function(xhr, status, error) {
							alert(xhr.responseText);
						}
					});
					return false;
				});*/
		
		
		$('#sampleForm').submit(
				function(event) {
					
					var postData = $(this).serializeArray();
					var firstname = $('#firstname').val();
					var lastname = $('#lastname').val();				
					var data = 'logout='
							+ encodeURIComponent(firstname)
							+ '&amp;error='
							+ encodeURIComponent(lastname);
					$.ajax({
						url : $("#sampleForm").attr("action"),
						data : postData,
						type : "GET",
		 
						success : function(response) {
							alert( "listo" );
							alert( response );
						},
						error : function(xhr, status, error) {
							alert(xhr.responseText);
						}
					});
					return false;
				});
		
		$( function(){
			   $("#displayTagDiv").displayTagAjax();
			});
			
	});

	
</script>
<tiles:insertDefinition name="defaultTemplate">
	<tiles:putAttribute name="body">


		<form id="sampleForm" method="post" action="login.action" >
			<div>
				<input type="text" name="userName" id="userName">
			</div>
			<div>
				<input type="text" name="password" id="password">
			</div>
			<div>
				<button type="submit" name="submit">Submit</button>
			</div>
		</form>
		<div>
			<input type="text" id="w-input-search" value=""> <span>
				<button id="w-button-search" type="button">Search</button> </span>
		</div>

		<div class="body">
			<h1>Home page!</h1>

			<p>The time on the server is ${serverTime}.</p>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
				do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
				enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
				ut aliquip ex ea commodo consequat. Duis aute irure dolor in
				reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
				pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
				culpa qui officia deserunt mollit anim id est laborum.</P>
		</div>

<div id="displayTagDiv"  >
		<display:table class="displayTag" uid="user" name="requestScope.userList" defaultsort="1"
			defaultorder="ascending" pagesize="3" requestURI="/">
			<display:column property="userName" sortable="true"
				title="Employee ID" maxLength="25" />
			<display:column property="password" sortable="true" title="Real Name"
				maxLength="25" />

			<display:setProperty name="basic.empty.showtable" value="true" />
			<display:setProperty name="paging.banner.group_size" value="10" />
			
			<display:setProperty name="export.excel.filename" value="prueba.xls"/>

		</display:table>
</div>
	</tiles:putAttribute>
</tiles:insertDefinition>
